package com.example.demo;

import com.deliveredtechnologies.rulebook.FactMap;
import com.deliveredtechnologies.rulebook.NameValueReferableMap;
import com.deliveredtechnologies.rulebook.model.runner.RuleBookRunner;

/**
 * @author lizhien (zhien.li@nascent.cn)
 * @version 1.0.0
 * @date 2022/3/18 16:02
 * @description com.example.demo
 */
public class RuleBookApplication {

    public static void main(String args[]) {
        RuleBookRunner ruleBook = new RuleBookRunner("com.example.demo");  //加载制定package中所有规则
        NameValueReferableMap facts = new FactMap();
        facts.setValue("num", 5);  //部门人数：5
        facts.setValue("deptLevel", "B");  //部门业绩评级：B
        facts.setValue("rank", 3); //该员工在部门考评中排名：3
        ruleBook.run(facts);
        ruleBook.getResult().ifPresent(System.out::println);  //打印规则执行的输出结果
    }

}
